<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>管理员登录</title>
	<link rel="stylesheet" href="themes/ui-lightness/jquery.ui.all.css">
	<script src="js/jquery-1.6.2.js"></script>
	<script src="external/jquery.bgiframe-2.1.2.js"></script>
	<script src="ui/jquery.ui.core.js"></script>
	<script src="ui/jquery.ui.widget.js"></script>
	<script src="ui/jquery.ui.mouse.js"></script>
	<script src="ui/jquery.ui.button.js"></script>
	<script src="ui/jquery.ui.draggable.js"></script>
	<script src="ui/jquery.ui.position.js"></script>
	<script src="ui/jquery.ui.resizable.js"></script>
	<script src="ui/jquery.ui.dialog.js"></script>
	<script src="ui/jquery.effects.core.js"></script>
	
	
	<script type="text/javascript">
	$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		var name = $( "#name" ),
			email = $( "#email" ),
			password = $( "#password" ),
			allFields = $( [] ).add( name ).add( password ),
			tips = $( ".validateTips" );

		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}
		function checkNull(o, n){
			if ( o.val().length<=0|| o.val()=='') {
				o.addClass( "ui-state-error" );
				updateTips(  n + " 不能为空！ " );
				return false;
			} else {
				return true;
			}
		}
		
		$( "#dialog-form" ).dialog({
			autoOpen: true,
			height: 330,
			width: 300,
			resizable:false,
			modal: false,
			buttons: {
				"登录": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );

					bValid = bValid && checkNull( name, "用户名" );
					bValid = bValid && checkNull( password, "密码");
					if ( bValid ) {
						//有效，提交
						alert("表单已提交");
					}
				},
				"重置": function() {
					allFields.val( "" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});

		$( "#create-user" )
			.button()
			.click(function() {
				$( "#dialog-form" ).dialog( "open" );
			});
	});
	</script>
		<style type="text/css">
			body { font-size: 12px;background:url('images/buildings.gif') repeat-x scroll -100px 0;}
			label, input { display:block; }
			label{margin-bottom:3px;}
			input.text { margin-bottom:8px; width:95%; padding: .4em; }
			fieldset { padding:0; border:0; margin-top:25px; }
			
			.ui-dialog .ui-state-error { padding: .3em; }
			.validateTips { border: 1px solid transparent; padding: 0.3em; }
		</style>
  </head>
  
  <body>
<div id="dialog-form" title="管理员登录">
	<p class="validateTips">欢迎使用，请登录！</p>

	<form>
	<fieldset>
		<label for="name">用户名</label>
		<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
		
		<label for="password">密码</label>
		<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
		<span>*推荐使用IE9/Firefox/chrome访问本站</span>
	</fieldset>
	</form>
</div>
</body>
</html>
